package net.xiduth.events.button;

import net.xiduth.events.ButtonEvent;
import net.xiduth.events.EventManager;
import net.xiduth.game.player.Player;

/**
 * @author Tyluur <ItsTyluur@Gmail.com>
 * @since 2012-07-30
 * Fixed by Jae <jae@xiduth.com>
 */
public class SquealTrollEvent implements ButtonEvent {

	@Override
	public boolean init() {
		return EventManager.register(1252, this);
	}

	@Override
	public boolean handle(Player player, int interfaceId, int buttonId,
			int packetId, int slotId, int slotId2) {
		switch(buttonId) {
		case 3:
			if (player.spins == 0) {
				player.sm("You don't have enough spins to play Squeal of Fortune.");
				return false;
			} else {
			player.getSquealOfFortune().sendMainScreen();
			}
			return true;
		case 5:
			player.getPackets().closeInterface(player.getInterfaceManager().hasRezizableScreen() ? 11 : 0);
			player.getPackets().sendGameMessage("The icon will appear the next time you log in.");
			return true;
		}
		return false;
	}

}
